import Http from "../http";
///todo
const baseURL = "/api";
///登录系统信息
export const login = function (loginForm: any) {
  return Http.post(baseURL + "/user/login", loginForm);
};
///获取用户信息
export const getUserInfo = function () {
  return Http.post(baseURL + "/user/info");
};
///表码数据配置信息
export const codeTableData = function (appId: any) {
  return Http.get(baseURL + "/init/getCodeData", appId);
};
///菜单信息
export const menuTree = function (appId: any) {
  return Http.get(baseURL + "/init/getAppNav", appId);
};
///页面信息
export const pageInfo = function (pageId: string | number) {
  return Http.get(baseURL + `/page/getPageInfo?pageId=${pageId}`);
};
///表格信息
export const tableInfo = function (tableInfo: any) {
  return Http.post(baseURL + "/page/getMainData", tableInfo);
};
//invoke交互api
export const interApi = function (apiInfo: any) {
  return Http.post(baseURL + "/invoke/method", apiInfo);
};
//invoke交互api
export const interDatasourceApi = function (apiInfo: any) {
  return Http.post(baseURL + "/invoke/datasource", apiInfo);
};
//获取页签
export const getTabData = function (apiInfo: any) {
  return Http.post(baseURL + "/page/getTabData", apiInfo);
};
//获取表单
export const getFormData = function (data: any) {
  return Http.post(baseURL + "/form/getFormData", data);
};
//保存表单
export const setFormData = function (data: any) {
  return Http.post(baseURL + "/form/saveFormData", data);
};
//按钮方法
export const handleBtnFun = function (data: any) {
  return Http.post(baseURL + "/invoke/func", { ...data });
};
//按钮方法
export const handleBtnFunMoreData = function (data: any) {
  return Http.post(baseURL + "/invoke/funcMoreData", data);
};
//关联-数据表类型字段取数
export const getColLookupData = function (data: any) {
  return Http.post(baseURL + "/form/getColLookupData", data);
};
//关联-服务列类型字段取数
export const getColServiceData = function (data: any) {
  return Http.post(baseURL + "/form/getColServiceData", data);
};
///页签页面获取页签信息
export const getTagPageTagList = function (data: any) {
  return Http.post(baseURL + "/init/getNavByPageId", data);
};
//下载文件
export const downloadFile = function (id: any) {
  return Http.get(baseURL + `/file/download?id=${id}`);
};
//复制数据
export const getCopyData = function (data: any) {
  return Http.post(baseURL + "/form/getCopyData", data);
};
